/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.uoc.tdp.pac3.rmi;

import edu.uoc.tdp.pac3.configuration.IConfiguration;
import edu.uoc.tdp.pac3.configuration.PropertiesConfiguration;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.logging.Level;
import java.util.logging.Logger;
import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 *
 * @author Gerard
 */
public class GestorIncidenciesTestCase {
    
    @Test
    public void test(){
        try {
            Registry registry = LocateRegistry.getRegistry(2020);
            GestorIncidenciesInterface incidencies = (GestorIncidenciesInterface) registry.lookup(PropertiesConfiguration.getInstance().getProperty(IConfiguration.RMI_NAME));
            Assert.assertNotNull(incidencies.sayHello());
        } catch (RemoteException ex) {
            Logger.getLogger(GestorIncidenciesTestCase.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NotBoundException ex) {
            Logger.getLogger(GestorIncidenciesTestCase.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
